// 浅拷贝
let x = [2,3,4,5]
let y = x.slice()

let a = [2,{x:1},[3,4],'h']
let b = a.slice() 
// a = [2,0001,0002,'h'] 

//深拷贝
// let str = JSON.stringify(a)
// let c = JSON.parse(str)
let c = JSON.parse(JSON.stringify(a))

//分清楚 赋值，浅拷贝，深拷贝
let e = a

// Object.assign() 用途：1，实现浅拷贝;2，合并对象
let x1 = {a:1,b:2}
let x2 = {c:3,d:5}
let x3 = {e:3,f:5}
let x4 = {...x1,...x2,...x3}
let x6 = {}
let x5 = Object.assign(x6,x1,x2,x3)